import request from '@/utils/request'
import {PositionType} from '@/utils/enum'
/**
 * 场地编辑
 * @param data 
 * @returns 
 */
export const SiteSave= (data:VenueEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting', data ,method:'POST'}) : request({ url: `meeting/${data.id}`, data ,method:'PUT'})
/**
 * 场地删除
 * @param id 
 * @returns 
 */
export const SiteDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/${id}`,method:'DELETE'})

/**
 * 场地详情
 * @param id 
 * @returns 
 */
export const GetSiteDetails =(id:number):Promise<ServiceResponse<VenueEdit>>=>request({url:`meeting/${id}`})

/**
 * 场地列表
 * @param data 
 * @returns 
 */
export const Meetings = (data: PageModel<VenueQuery>): Promise<ServiceResponse<Venue[]>> => request({ url: `Meeting/list`,data,method:'POST'})
/**
 * 场地修改排序
 * @param id 
 * @param sequence 
 * @returns 
 */
export const UpdateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/sequence', data:{id , sequence} ,method:'GET'})


/**
 * 会议室编辑
 * @param data 
 * @returns 
 */
 export const MeetingSave= (data:MeetingRoomEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/meeting', data ,method:'POST'}) : request({ url: `meeting/meeting/${data.id}`, data ,method:'PUT'})

 /**
 * 会议室删除
 * @param id 
 * @returns 
 */
export const MeetingDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/meeting/${id}`,method:'DELETE'})
/**
 * 会议室列表
*/
export const GetMeetings = (venueId: number,name: string): Promise<ServiceResponse<MeetingRoomView[]>> => request({url: 'meeting/meeting/list',data: { venueId,name },method:'GET'})

/**
 * 会议室详情
 */
export const GetMeetingDetails =(id:number):Promise<ServiceResponse<MeetingRoomEdit>>=>request({url:`meeting/meeting/${id}`})

 /**
 * 会议室修改排序
 * @param id 
 * @returns 
 */
 export const UpdateMeetingSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/meeting/sequence', data:{id , sequence} ,method:'GET'})


/**
 * 客房编辑
 * @param data 
 * @returns 
 */
 export const GuestSave= (data:GuestRoomEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/guest', data ,method:'POST'}) : request({ url: `meeting/guest/${data.id}`, data ,method:'PUT'})

 /**
 * 客房删除
 * @param id 
 * @returns 
 */
export const GuestRoomDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/guest/${id}`,method:'DELETE'})

/**
 * 客房列表
*/
export const GetGuests = (venueId: number,name: string): Promise<ServiceResponse<GuestRoom[]>> => request({url: 'meeting/guest/list',data: { venueId,name },method:'GET'})

/**
 * 客房详情
 */
 export const GetGuestDetails =(id:number):Promise<ServiceResponse<GuestRoomEdit>>=>request({url:`meeting/guest/${id}`})

 /**
 * 客房修改排序
 * @param id 
 * @returns 
 */
 export const UpdateGuestSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/guest/sequence', data:{id , sequence} ,method:'GET'})


/**
 * 餐厅编辑
 * @param data 
 * @returns 
 */
 export const DiningSave= (data:DiningRommEdit): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/dining', data ,method:'POST'}) : request({ url: `meeting/dining/${data.id}`, data ,method:'PUT'})

 /**
 * 餐厅删除
 * @param id 
 * @returns 
 */
  export const DiningDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/dining/${id}`,method:'DELETE'})

/**
 * 餐厅列表
*/
 export const GetDinings = (venueId: number,name: string): Promise<ServiceResponse<DiningRomm[]>> => request({url: 'meeting/dining/list',data: { venueId,name },method:'GET'})

/**
 * 餐厅详情
 */
 export const GetDiningDetails =(id:number):Promise<ServiceResponse<DiningRommEdit>>=>request({url:`meeting/dining/${id}`})

  /**
 * 客房修改排序
 * @param id 
 * @returns 
 */
  export const UpdateDiningSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/dining/sequence', data:{id , sequence} ,method:'GET'})

  
/**
 * 包间编辑
 * @param data 
 * @returns 
 */
 export const PrivateSave= (data:PrivateRooms): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/dining/private', data ,method:'POST'}) : request({ url: `meeting/dining/${data.id}`, data ,method:'PUT'})

 /**
 * 包间删除
 * @param id 
 * @returns 
 */
  export const PrivateDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/dining/private/${id}`,method:'DELETE'})

/**
 * 包间列表
*/
 export const GetPrivates = (venueId: number,name: string): Promise<ServiceResponse<PrivateRooms[]>> => request({url: 'meeting/dining/private/list',data: { venueId,name },method:'GET'})

 /* 包间修改排序
 * @param id 
 * @returns 
 */
  export const UpdatePrivateSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/dining/private/sequence', data:{id , sequence} ,method:'GET'})

 /**
 * 分类编辑
 * @param data 
 * @returns 
 */
 export const CategorySave= (data:SiteCategory): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/category', data ,method:'POST'}) : request({ url: `meeting/category/${data.id}`, data ,method:'PUT'})

/**
 * 分类删除
 * @param id 
 * @returns 
 */
 export const CategoryDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/category/${id}`,method:'DELETE'})
/**
 * 分类修改排序
 * @param id 
 * @returns 
 */
 export const UpdateCategorySequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/category/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 分类列表
*/
 export const GetCategorys = (name: string): Promise<ServiceResponse<SiteCategory[]>> => request({url: 'meeting/category/list',data: { name },method:'GET'})

 /**
 * 特色编辑
 * @param data 
 * @returns 
 */
  export const FeatureSave= (data:Feature): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/feature', data ,method:'POST'}) : request({ url: `meeting/feature/${data.id}`, data ,method:'PUT'})


/**
 * 特色删除
 * @param id 
 * @returns 
 */
 export const FeatureDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/feature/${id}`,method:'DELETE'})
 /**
 * 特色列表
*/
export const Features = (name: string,typeId? : PositionType): Promise<ServiceResponse<Feature[]>> => request({url: 'meeting/feature/list',data: { name,typeId },method:'GET'})
/**
 * 特色修改排序
 * @param id 
 * @returns 
 */
 export const UpdateFeaturesSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/feature/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 设备编辑
 * @param data 
 * @returns 
 */
  export const FacilitieSave= (data:Facilitie): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/facilitie', data ,method:'POST'}) : request({ url: `meeting/facilitie/${data.id}`, data ,method:'PUT'})

/**
 * 设备删除
 * @param id 
 * @returns 
 */
 export const FacilitieDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/facilitie/${id}`,method:'DELETE'})
 
 /**
 * 设备列表
 * @param id 
 * @returns 
 */
  export const Facilities = (data: PageModel<FacilitiesQuery>): Promise<ServiceResponse<Facilitie[]>> => request({ url: `meeting/facilitie/list`,data,method:'POST'})
 
/**
 * 设备详情
 */
 export const GetFacilitieDetails =(id:number):Promise<ServiceResponse<Facilitie>>=>request({url:`meeting/Facilitie/${id}`})
 /**
 * 设备修改排序
 * @param id 
 * @returns 
 */
  export const UpdateFacilitieSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/facilitie/sequence', data:{id , sequence} ,method:'GET'})

/**
 * 品牌编辑
 * @param data 
 * @returns 
 */
   export const BrandSave= (data:Brand): Promise<ServiceResponse<any>> => data.id === 0 ? request({ url: 'meeting/brand', data ,method:'POST'}) : request({ url: `meeting/brand/${data.id}`, data ,method:'PUT'})

/**
 * 品牌删除
 * @param id 
 * @returns 
 */
 export const BrandDelete = (id: number): Promise<ServiceResponse<any>> => request({ url: `meeting/brand/${id}`,method:'DELETE'})
  /**
 * 品牌列表
 * @param id 
 * @returns 
 */
   export const Brands = (data: PageModel<BrandQuery>): Promise<ServiceResponse<Brand[]>> => request({ url: `meeting/brand/list`,data,method:'POST'})
  /**
 * 品牌修改排序
 * @param id 
 * @returns 
 */
   export const UpdatetBrandSequence = (id: number,sequence: number): Promise<ServiceResponse<any>> => request({ url: 'meeting/brand/sequence', data:{id , sequence} ,method:'GET'})
   /**
    * 修改品牌合作状态
    * @param id 
    * @param partner 
    * @returns 
    */
   export const UpdatetBrandPartner = (id: number,partner: boolean): Promise<ServiceResponse<any>> => request({ url: `meeting/brand/partner/${id}`, data:{ partner } ,method:'GET'})
